package day20.String;

import java.util.Scanner;

public class StringTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        System.out.print("请输入一个字符串:");
        String input = scanner.nextLine();
        
        System.out.println("字符串的长度为: " + input.length());
        
        if (input.length() > 2) {
            System.out.println("索引为2的字符是: " + input.charAt(2));
        } else {
            System.out.println("字符串长度不足，没有索引为2的字符");
        }

        System.out.println("字符串中字符的个数为: " + input.length());
        
        scanner.close();
    }
}
